<%@ page import="com.scalar.chiptrack.commons.Constants,
                 com.scalar.chiptrack.utils.ConfigManager,
                 com.scalar.chiptrack.commons.SessionKeys" language="java" %>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/bomDataEntry.do"/>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>

<script language="javascript">
var binListSize = 0;
function selectPartNumber()
{
    if( document.bomDataEntryForm.processStepId.value=='0' )
    {
        document.bomDataEntryForm.action="<%=chipTracContext%>/bomDataEntry.do";
	    document.bomDataEntryForm.submit();
        return;
    }

	if(document.bomDataEntryForm.locationId!=null )
    {
	    document.bomDataEntryForm.locationId.value='0';
    }

	document.bomDataEntryForm.action="<%=chipTracContext%>/bomDataEntry.do?action=partnumber";
	document.bomDataEntryForm.submit();
}
function selectLocation()
{
    var form = document.bomDataEntryForm;

	if(document.bomDataEntryForm.locationId.value=='0')
    {
        document.bomDataEntryForm.action="<%=chipTracContext%>/bomDataEntry.do?action=partnumber";
	    document.bomDataEntryForm.submit();
	    return ;
    }
    if(productSelected(form)==false)
    {
        return;
    }

	document.bomDataEntryForm.action="<%=chipTracContext%>/bomDataEntry.do?action=location";
	document.bomDataEntryForm.submit();
}


function selectLotNumber()
{
    var form = document.bomDataEntryForm;

	if(document.bomDataEntryForm.lotId.value=='0')
    {
        document.bomDataEntryForm.action="<%=chipTracContext%>/bomDataEntry.do?action=location";
	    document.bomDataEntryForm.submit();
    	return ;
    }

	if( productSelected(form) == false )
    {
        return;
    }

    if( locationSelected(form)==false )
    {
        return;
    }

	document.bomDataEntryForm.action="<%=chipTracContext%>/bomDataEntry.do?action=lotnumber";
	document.bomDataEntryForm.submit();
}

var dateElement = "";
function openCalendar(dateValue)
{
	dateElement = dateValue;
	newWindow = window.open('<%=chipTracContext%>/jsp/includes/calendar.html','optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,titlebar=no,personalbar=no,status=no,scrollbars=no,width=180,height=440,resizable=no');
	newWindow.moveTo(550,180);
	newWindow.focus();
}

function assignDate(passedValue)
{
	dateElement.value=passedValue;
	window.focus();
}
function cal()
{
	var pa=document.getElementById("message");
	var quantityIn = document.bomDataEntryForm.qtyIn.value;
	var quantityOut = document.bomDataEntryForm.qtyOut.value;

	if(quantityIn!='' && quantityOut!='')
	{
		if (!isInteger(quantityIn))
		{
			pa.innerHTML = "<li>Please enter valid Quantity In, Quantity In must be number";
			return;
		}

		if (!isInteger(quantityOut))
		{
			pa.innerHTML = "<li>Please enter valid Quantity Out, Quantity Out must be number";
			return;
		}

		if( parseInt(quantityOut) > parseInt(quantityIn) )
		{
			pa.innerHTML = "<li>Quantity Out can not be greater than the Quantity In";
			return;
		}
	}
	pa.innerHTML = "";
}

function saveBOM()
{
	var qty_in			= document.bomDataEntryForm.qtyIn.value;
	var qty_out			= document.bomDataEntryForm.qtyOut.value;
	var date_in			= document.bomDataEntryForm.dateIn.value;
	var date_out		= document.bomDataEntryForm.dateOut.value;
    var form			= document.bomDataEntryForm;
    var lotCategoryCtrl = form.lotCategory;
    var lotStatusCtrl   = form.lotStatus;
    var pa				= document.getElementById("message");
	pa.innerHTML = "";

	if( productSelected(form) == false )
    {
        return;
    }
    if( locationSelected(form) == false )
    {
        return;
    }
    if( lotNoSelected(form) == false )
    {
        return;
    }

    if( form.lotId.value == "-1" )
    {
        if( form.lotNumber.value == "" )
        {
            pa.innerHTML  = "<li>" + "Enter Lot Number" + "</li>";
            form.lotNumber.focus();
            return;
        }
        if( form.lotNumber.value.indexOf("'") != "-1" )
        {
            pa.innerHTML = "<li>Single quotation is not acceptable in Lot Number</li>";
            form.lotNumber.focus();
            return;
        }
    }
    /*if( form.vendorLot.value.indexOf("'") != "-1" )
    {
        pa.innerHTML = "<li>Single quotation is not acceptable in Vendor Lot Number</li>";
        form.vendorLot.focus();
        return;
    }*/

	if ( document.bomDataEntryForm.lotId.value == -1 )
	{
		if ( !checkLotNumber() )
		{
			pa.innerHTML = '<li>Please enter a different Lot number. This lot number already exists';
			//document.bomDataEntry.lotId.focus();
			return;
		}
	}
    if ( checkInteger( form.qtyIn.value , 'Quantity In ' , 'Y'  ) == false)
    {
        pa.innerHTML  = "<li>" + errMsg + "</li>";
        form.qtyIn.focus();
        return;
	}
    if ( chkDate ( form.dateIn.value , 'DateIn ' , 'Y' ) == false ){
          pa.innerHTML  = errMsg;
          form.dateIn.focus();
          return;
    }

	if( qty_in != '' )
	{
		if ( qty_in == 0 )
		{
			pa.innerHTML = "<li>Zero value is not permitted for Quantity In, Please enter greater than Zero";
			document.bomDataEntryForm.qtyIn.focus();
			return;
		}
		if( !isInteger(qty_in) )
		{
			pa.innerHTML = "<li>Please enter valid Quantity In, Quantity In must be number";
			document.bomDataEntryForm.qtyIn.focus();
			return;
		}
	}

	if( qty_out!='' )
	{
		if( !isInteger(qty_out) )
		{
			pa.innerHTML = "<li>Please enter valid Quantity Out, Quantity Out must be number";
			document.bomDataEntryForm.qtyOut.focus();
			return;
		}
        if ( qty_out == 0 )
		{
			pa.innerHTML = "<li>Zero value is not permitted for Quantity Out, Please enter greater than Zero";
			document.bomDataEntryForm.qtyOut.focus();
			return;
		}
        if( date_out=='' )
		{
			pa.innerHTML = "<li>Please Enter Date Out";
			document.bomDataEntryForm.dateOut.focus();
			return;
		}
	}

	if( date_in!='' )
	{
        if ( chkDate ( date_in , 'Date In ' , 'Y' ) == false )
		{
			pa.innerHTML = errMsg;
			document.bomDataEntryForm.dateIn.focus();
			return;
        }
	}
	if(date_out!='')
	{
        if ( chkDate ( date_out , 'Date Out ' , 'Y' ) == false )
		{
			pa.innerHTML = errMsg;
			document.bomDataEntryForm.dateOut.focus();
			return;
        }
		if( qty_out == '' )
		{
			pa.innerHTML = "<li>Please Enter Quantity Out";
			document.bomDataEntryForm.qtyOut.focus();
			return;
		}
	}
    if ( lotCategoryCtrl.value == '' )
    {
        pa.innerHTML = "<li>Please select Lot Category";
        lotCategoryCtrl.focus();
        return;
    }
    if ( lotStatusCtrl.value == '' )
    {
        pa.innerHTML = "<li>Please select Lot Status";
        lotStatusCtrl.focus();
        return;
    }
    if( date_in!='' && date_out!='' )
	{
		if (!validateDateOut(formatDateAsMMDDYYYY(date_in),formatDateAsMMDDYYYY(date_out)))
		{
			pa.innerHTML = "<li>Date Out cannot be less than Date In";
			document.bomDataEntryForm.dateOut.focus();
			return;
		}
	}

	if( qty_in!='' && qty_out!='' )
	{
		if (parseInt(qty_out) > parseInt(qty_in))
		{
			pa.innerHTML = "<li>Quantity Out can not be greater than the Quantity In";
			document.bomDataEntryForm.qtyOut.focus();
			return;
		}
	}

	if( form.comments.value.trim().length > 1000 )
	{
		pa.innerHTML = "<li>Comments should not be greater than 1000 characters";
        form.comments.focus();
        return;
	}
    if(document.bomDataEntryForm.lotNumber.value == '')
    {
        document.bomDataEntryForm.lotNumber.value=document.bomDataEntryForm.lotId.options[document.bomDataEntryForm.lotId.selectedIndex].text;
    }
    <logic:equal property='processType' name='bomDataEntryForm' value="Die Bank">
    <% if ( ConfigManager.isBomPullingByWaferId() )
    {
    %>
        if ( binListSize == 0 )
        {
            pa.innerHTML = "<li>Please enter Bin details";
            return;
        }
    <% } %>
    var totalBinQty = 0;
    for ( var k=0; k < binListSize; k++ )
    {
        var waferIdCtrl = form['bomLotBinData['+k+'].waferId'];
        var binQtyCtrl  = form['bomLotBinData['+k+'].binQty'];
        if ( waferIdCtrl.value != '' && binQtyCtrl.value != '' )
        {
            if( !isInteger(waferIdCtrl.value) )
            {
                pa.innerHTML = "<li>Please enter valid Wafer Id, Wafer Id must be number";
                showBinData();
                waferIdCtrl.focus();
                return;
            }
            if( !isInteger(binQtyCtrl.value) )
            {
                pa.innerHTML = "<li>Please enter valid Bin Qy, Bin Qy must be number";
                showBinData();
                binQtyCtrl.focus();
                return;
            }
            if ( waferIdCtrl.value == '0' )
            {
                pa.innerHTML = "<li>Zero value is not permitted for Wafer Id, Please enter greater than Zero";
                showBinData();
                waferIdCtrl.focus();
                return;
            }
            totalBinQty = totalBinQty + (+binQtyCtrl.value);
        }
        else if ( waferIdCtrl.value == '' && binQtyCtrl.value != '' )
        {
            pa.innerHTML = "<li>Please enter value for Wafer Id";
            showBinData();
            waferIdCtrl.focus();
            return;
        }
    }
    //checking for duplicate wafer ids
    for ( var i=0; i<binListSize-1; i++ )
    {
        for (var j = i + 1; j < binListSize; j++ )
        {
            var waferId1 = form['bomLotBinData['+i+'].waferId'].value;
            var waferId2 = form['bomLotBinData['+j+'].waferId'].value;
            if ( waferId1 != "" && waferId2 != "" && waferId1 == waferId2 )
            {
                pa.innerHTML = "<li>Duplicate Wafer Id is not allowed";
                showBinData();
                form['bomLotBinData['+j+'].waferId'].focus();
                return;
            }
        }
    }
    if ( binListSize > 0 && totalBinQty != qty_in )
    {
        pa.innerHTML = "<li>Quantity In and total Bin Qty should be equal";
        return;
    }
    </logic:equal>
    document.bomDataEntryForm.partNumber.value=document.bomDataEntryForm.processStepId.options[document.bomDataEntryForm.processStepId.selectedIndex].text;
    document.bomDataEntryForm.locationName.value=document.bomDataEntryForm.locationId.options[document.bomDataEntryForm.locationId.selectedIndex].text;
	document.bomDataEntryForm.action="<%=chipTracContext%>/bomDataEntry.do?action=save" ;
	document.bomDataEntryForm.submit();
}


function locationSelected(form)
{
    var pa=document.getElementById("message");
    var x = form.locationId;

    for( var i = 0; i < x.length; i++ )
    {
        if( x.options[i].selected )
        {
	        if( x.options[i].value == "0" )
            {
	            pa.innerHTML = "<li>Select Location</li>";
                x.focus();
	            return false;
            }
        }
    }
    return true;
}

function productSelected(form)
{
    var pa = document.getElementById("message");
    var x = form.processStepId;

    for( var i = 0; i < x.length; i++ )
    {
        if( x.options[i].selected )
        {
	        if( x.options[i].value == "0" )
            {
	            pa.innerHTML = "<li>Select Product Name</li>";
                x.focus();
	            return false;
            }
        }
    }
    return true;
}

function lotNoSelected(form)
{
    var pa = document.getElementById("message");
    var x = form.lotId;

    for( var i = 0; i < x.length; i++ )
    {
        if( x.options[i].selected )
        {
	        if( x.options[i].value == "0" )
            {
	            pa.innerHTML = "<li>Select Lot Number</li>";
                x.focus();
	            return false;
            }
        }
    }
    return true;
}

function checkLotNumber()
{
	var lotName = '';
	var flag = true;
    var lotNumber = document.bomDataEntryForm.lotNumber.value.trim();

	for (var count =0; count < document.bomDataEntryForm.lotId.length; count++ )
	{
		lotName = document.bomDataEntryForm.lotId[count].text;
        if (lotName.toUpperCase() == lotNumber.toUpperCase())
		{
			flag = false;
            break;
		}
	}
	return flag;
}

function checkLength(element, size)
{
    if(	element.value.length >= size )
	{
		event.returnValue = false;
	}
}

function refreshParent()
{
    document.bomDataEntryForm.qtyOut.disabled = false;
	document.bomDataEntryForm.action="<%=chipTracContext%>/bomDataEntry.do?action=refresh";
	document.bomDataEntryForm.submit();
}

function getBomParts()
{
    document.bomDataEntryForm.action="<%=chipTracContext%>/bomDataEntry.do";
    document.bomDataEntryForm.submit();
}
function showBinData()
{
    var binTable = document.getElementById("binTable");
    if( binTable.style.display == 'none')
    {
        binTable.style.display = "block";
    }
}
function toggleBinData()
{
	var pa=document.getElementById("message");
	pa.innerHTML = '';
    var pa1=document.getElementById("binTable");
    if( pa1.style.display == 'none')
    {
        pa1.style.display = "block";
    }
    else
    {
        pa1.style.display = "none";
    }

}

function addMore()
{
    var tab = document.getElementById ("binTable");
    var index = tab.rows.length;

    var newRow = tab.insertRow ( index-1 );
    var newCell = newRow.insertCell(-1);
    newCell.align = "center"
    var htmltext = '<input type="text" name="bomLotBinData['+parseInt(binListSize,10)+'].waferId" size=6 class="valuetxfield" onkeypress="javascript:allowInteger()">';
    newCell.innerHTML = htmltext;

    newCell = newRow.insertCell(-1);
    newCell.align = "center"
    htmltext = '<input type="text" name="bomLotBinData['+parseInt(binListSize,10)+'].binQty" size=8 class="valuetxfield" onkeypress="javascript:allowInteger()" onchange= "javascript:calculateBinTotal();" >';
    newCell.innerHTML = htmltext;

    binListSize++;
}

function calculateBinTotal()
{
   var form = document.bomDataEntryForm;
   var totalQty = 0;

   for ( var i=0; i<binListSize; i++ )
   {
      if (form['bomLotBinData['+i+'].binQty'].value != '' )
      {
         /* if( !isValidInteger( form['bomLotBinData['+i+'].binQty'] ) )
          {
             return;
          }*/

          totalQty += parseInt(form['bomLotBinData['+i+'].binQty'].value );
       }
   }

    if ( form.lotNumber.value =="-1" )
    {
        form.qtyIn.value  = totalQty;
    }
    else
    {
        if ( form.lotId.value == "-1" || parseInt(form.lotId.value) > 0 )
        {
           form.qtyIn.value  = totalQty;
        }
    }
}

function showBinInfo()
{
  var form = document.bomDataEntryForm;
  var pa1=document.getElementById("binTable");
  if ( binListSize > 0 )
  {
       if ( form['bomLotBinData[0].waferId'].value != '' )
       {
            pa1.style.display = "block";
       }
  }
}

</script>

<BODY bgColor='#ffffff' leftMargin='0' topMargin='0' marginheight='0' marginwidth='0' onload="showBinInfo()">

<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
	<td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->
<%@ include file="/jsp/operations/dataentryMenu.jsp" %>
<!-- end of the side navigations -->
<TD bgcolor="#ffffff">
<IMG height=9 src="images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="100%">

<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<BR>
<!-- from here your body starts -->

<html:form name="bomDataEntryForm"  type="com.scalar.chiptrack.operations.dataentry.forms.BOMDataEntryForm" action="/bomDataEntry">

<center><span class="NArialW">BOM Inventory </span></center>
<img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20>
<font class="NArialL">
<table border="0" width="90%" align=center>
    <tr><td colspan="4" class='NArialL'>&nbsp;<strong><FONT id="message" color='FF0000'></FONT></strong></td></tr>
    <tr><td colspan="4">&nbsp;</td></tr>
    <tr>
        <td colspan="4">
            <chiptrack:info styleClass="NArialL" />
            <chiptrack:errors styleClass="NArialL" />
            <chiptrack:messages type="info" styleClass="NArialL" />
        </td>
    </tr>
    <logic:equal name="showMessage" value="TRUE">
        <tr><td colspan="4" align='left'><font class='NArialS'color='blue'><b><%=Constants.NO_MODIFY_RIGHTS %></b></font></td></tr>
    </logic:equal>
    <tr>
        <td>
            <table border="0" width="100%">
                <tr>
                    <td width="20%"><font class="NArialL">BOM Process Type:</font></td>
                    <td width="25%">
                        <font class="NArialL">
                            <html:select property="processType"  name="bomDataEntryForm" styleClass="txfield" onchange="getBomParts()" >
                                <html:options collection="processTypes" property="value" labelProperty="label"/>
                            </html:select>
                        </font>
                    </td>
                    <td width="20%"><font class="NArialL">Product Name:</font></td>
                    <td width="25%">
                        <font class="NArialL">
                            <html:select property="processStepId"  name="bomDataEntryForm" styleClass="txfield" onchange="selectPartNumber()" >
                                <html:option value="0">Select Part Number</html:option>
                                <html:options collection="partNumberSelectList" property="value" labelProperty="label"/>
                            </html:select>
                        </font>
                    </td>
                    <td width="20%">&nbsp;</td>
                    <td width="25%">&nbsp;</td>
                </tr>
                <tr>
                    <logic:equal name ="action" value="partnumber" >
                        <td width="20%"><font class="NArialL">&nbsp;&nbsp;Location:</font></td>
                        <td width="20%" align=left class="NArialL">
                            <html:select property="locationId"  name="bomDataEntryForm" styleClass="txfield" onchange="selectLocation()" >
                                <html:option value="0">Select Location</html:option>
                                <html:options collection="bomLocationList" property="value" labelProperty="label"/>
                             </html:select>
                        </td>
                    </logic:equal>
                    <logic:equal name ="action" value="location" >
                        <td width="20%"><font class="NArialL">Location:</font></td>
                        <td width="20%" align=left class="NArialL">
                            <html:select property="locationId"  name="bomDataEntryForm" styleClass="txfield" onchange="selectLocation()" >
                                <html:option value="0">Select Location</html:option>
                                <html:options collection="bomLocationList" property="value" labelProperty="label"/>
                            </html:select>
                        </td>
                    </logic:equal>

                    <logic:equal name ="action" value="lotnumber" >
                        <td width="20%"><font class="NArialL">Location:</font></td>
                        <td width="20%" align=left class="NArialL">
                            <html:select property="locationId"  name="bomDataEntryForm" styleClass="txfield" onchange="selectLocation()" >
                                <html:option value="0">Select Location</html:option>
                                <html:options collection="bomLocationList" property="value" labelProperty="label"/>
                            </html:select>
                        </td>
                    </logic:equal>
                    <logic:equal name ="action" value="save" >
                        <td width="20%"><font class="NArialL">Location:</font></td>
                        <td width="20%" align=left class="NArialL">
                            <html:select property="locationId"  name="bomDataEntryForm" styleClass="txfield" onchange="selectLocation()" >
                                <html:option value="0">Select Location</html:option>
                                <html:options collection="bomLocationList" property="value" labelProperty="label"/>
                            </html:select>
                        </td>
                    </logic:equal>
                    <logic:equal name ="action" value="location" >
                        <td width="25%"><font class="NArialL">Lot Number:</font></td>
                        <td width="25%" class="NArialL">
                            <html:select property="lotId"  name="bomDataEntryForm" styleClass="txfield" onchange="selectLotNumber()" >
                                <html:option value="0">Select Lot  Number</html:option>
                                <html:option value="-1">--New Lot Number--</html:option>
                                <html:options collection="lotNumbersList" property="value" labelProperty="label"/>
                            </html:select>
                        </td>
                    </logic:equal>
                    <logic:equal name ="action" value="lotnumber" >
                        <td width="25%"><font class="NArialL">Lot Number:</font></td>
                        <td width="25%" class="NArialL">
                            <html:select property="lotId"  name="bomDataEntryForm" styleClass="txfield" onchange="selectLotNumber()" >
                                <html:option value="0">Select Lot  Number</html:option>
                                <html:option value="-1">--New Lot Number--</html:option>
                                <html:options collection="lotNumbersList" property="value" labelProperty="label"/>
                            </html:select>
                        </td>
                    </logic:equal>
                    <logic:equal name ="action" value="save" >
                        <td width="25%"><font class="NArialL">Lot Number:</font></td>
                        <td width="25%" class="NArialL">
                            <html:select property="lotId"  name="bomDataEntryForm" styleClass="txfield" onchange="selectLotNumber()" >
                                <html:option value="0">Select Lot  Number</html:option>
                                <html:option value="-1">--New Lot Number--</html:option>
                                <html:options collection="lotNumbersList" property="value" labelProperty="label"/>
                            </html:select>
                        </td>
                    </logic:equal>
                    <td width="20%"></td>
                    <td width="20%"></td>
                </tr>
                <tr>
                    <td width="100%" colspan="4">&nbsp;</td>
                </tr>

                <tr><td colspan=4 width="100%"></td></tr>

                <logic:equal name ="action" value="lotnumber" >
                    <tr>
                        <logic:equal name="bomDataEntryForm" property="lotId" value="-1">
                            <td width="25%"><font class="NArialL">New Lot Number: &nbsp;<font color="red">*</font></font></td>
                            <td width="25%" class="NArialL">
                                <html:text  property="lotNumber" size="25" styleClass="txfield" maxlength="50" name="bomDataEntryForm" /></font>
                            </td>
                            <td width="50%" colspan=2><font class="NArialL">&nbsp;</font></td>
                        </logic:equal>
                        <logic:notEqual name="bomDataEntryForm" property="lotId" value="-1">
                            <td width="100%" colspan=4 class="NArialL">&nbsp;
                                <html:hidden  property="lotNumber" name="bomDataEntryForm" />
                            </td>
                        </logic:notEqual>
                    </tr>
                    <tr>
                        <td width="25%"><font class="NArialL">Quantity In: &nbsp;<font color="red">*</font></font></td>
                        <td width="25%">
                            <html:text name="bomDataEntryForm" property="qtyIn" size="17" styleClass="valuetxfield" onchange="cal()" maxlength="7" onkeypress="allowInteger()"/>
                        </td>
                        <td width="25%"><font class="NArialL">Quantity Out:</font></td>
                        <td width="25%">
                            <html:text name="bomDataEntryForm" property="qtyOut" size="17" styleClass="valuetxfield"/>
                        <%--<logic:equal property='bomLotBinDataEntered' name='bomDataEntryForm' value="false">
                            <logic:equal property='qtyOut' name='bomDataEntryForm' value="">
                                <html:text name="bomDataEntryForm" property="qtyOut" size="17" styleClass="valuetxfield" onchange="cal()" maxlength="7" onkeypress="allowInteger()"/>
                            </logic:equal>
                            <logic:notEqual property='qtyOut' name='bomDataEntryForm' value="">
                                <html:text name="bomDataEntryForm" property="qtyOut" size="17" styleClass="valuetxfield" disabled="true"/>
                            </logic:notEqual>
                        </logic:equal>
                        <logic:equal property='bomLotBinDataEntered' name='bomDataEntryForm' value="true">
                            <html:text name="bomDataEntryForm" property="qtyOut" size="17" styleClass="valuetxfield" disabled="true"/>
                        </logic:equal>--%>
                       </td>
                    </tr>
                    <TR>
                        <TD width="25%"><font class="NArialL">Lot Category:<font color="red"><b>*</b></font></font></TD>
                        <TD width="25%" class="NArialL">
                            <html:select name="bomDataEntryForm" property="lotCategory" styleClass="txfield" >
                                <html:option value="">Select Lot Category</html:option>
                                <html:options collection="lotCategoryList" property="value" labelProperty="label"/>
                            </html:select>
                        </TD>
                        <TD width="25%"><font class="NArialL">Lot Status:<font color="red"><b>*</b></font></font></TD>
                        <TD width="25%" class="NArialL">
                            <html:select name="bomDataEntryForm" property="lotStatus" styleClass="txfield" >
                                <html:option value="">Select Lot Status</html:option>
                                <html:options collection="lotStatusList" property="value" labelProperty="label"/>
                            </html:select>
                        </TD>
                    </TR>
                    <tr>
                        <td width="25%"><font class="NArialL">Date In: &nbsp;<font color="red">*</font></font></td>
                        <td width="25%" class="NArialL">
                            <html:text name="bomDataEntryForm" property="dateIn" size="17" styleClass="txfield" maxlength="10"/>
                            <a href="javascript:openCalendar(document.bomDataEntryForm.dateIn)">
                            <img onMouseOver="window.status='Click here to select date';return true" onMouseOut="window.status='';return true" border="0" align='center'
                            src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20></a>
                        </td>
                        <td width="25%"><font class="NArialL">Date Out:&nbsp;&nbsp;</font></td>
                        <td width="25%" class="NArialL">
                            <html:text name="bomDataEntryForm" property="dateOut" size="17" styleClass="txfield"  maxlength="10"/>
                            <a href="javascript:openCalendar(document.bomDataEntryForm.dateOut)">
                            <img onMouseOver="window.status='Click here to select date';return true" onMouseOut="window.status='';return true" border="0" align='center'
                            src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20></a>
                        </td>
                    </tr>
                    <tr>
                        <td width="25%"><font class="NArialL">Date Code:</font></td>
                        <td width="25%">
                            <html:text name="bomDataEntryForm" property="dateCode" size="17" styleClass="txfield"  maxlength="50" />
                        </td>
                        <logic:equal property='processType' name='bomDataEntryForm' value="Die Bank">
                            <td width="25%" class="NArialL">
                                <a href="javascript:toggleBinData();" onMouseOver="window.status='Click here to Entry BOM Bin Data';return true" onMouseOut="window.status='';return true">
                                BOM Bin Data Entry</a>
                            </td>
                        </logic:equal>
                        <%--<td width="25%"><font class="NArialL">Vendor Lot Number:</font></td>
                        <td width="25%">
                            <html:text name="bomDataEntryForm" property="vendorLot" size="17" styleClass="txfield"  maxlength="50" />
                        </td>--%>
                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                        <td colspan="3">
                             <table align="center" border="0" id="binTable" style="display:none;" width="40%">
                                <tr>
                                    <td width="10%" align='center' bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Wafer Id</font></td>
                                    <td width="10%" align='center' bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Bin Qty</font></td>
                                </tr>
                                <nested:iterate name='bomDataEntryForm' property="bomLotBinData">
                                    <tr>
                                        <nested:empty property="waferId">
                                            <td align='center'><nested:text property="waferId" readonly="false" size="6" styleClass="valuetxfield" onkeypress="javascript:allowInteger()"></nested:text></td>
                                        </nested:empty>
                                        <nested:notEmpty property="waferId" >
                                            <td align='center'><nested:text property="waferId" readonly="true" size="6" styleClass="valuetxfield"></nested:text></td>
                                        </nested:notEmpty>
                                        <td align='center'><nested:text property="binQty" size="8" styleClass="valuetxfield" onkeypress="javascript:allowInteger()" onchange= "javascript:calculateBinTotal();"></nested:text></td>
                                    </tr>
                                </nested:iterate>
                                <nested:size id="binCount" property="bomLotBinData"></nested:size>
                                <script type="text/javascript">
                                    binListSize = <%= binCount.intValue()%>;
                                </script>
                                <tr>
                                    <td>&nbsp;</td>
                                    <TD align=right><a href="javascript:addMore();"><img src="<%=chipTracContext%>/jsp/includes/images/addmore.gif" border="0" onmouseover="window.status='Click to Add Bin Info';return true" onmouseout="window.status='';return true" title="Click here to Add Bin Info"/></a></TD>
                                </tr>
                            </table>
                        </td>
                    </tr>

                    <tr>
                        <td class='NArialL'>Comments : </td>
                        <td colspan = 3>
                            <html:textarea property="comments" name="bomDataEntryForm"  styleClass="txfield" rows="4" cols="80" onkeypress="javascript:checkLength(this, 1000)" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td>
                    </tr>
                    <tr>
                        <td colspan="4" align=center>
                            <chiptrack:restrictedLink functionality='<%=Functionality.BOM_INVENTORY%>' action='<%=User.USER_ACTION_MODIFY%>' href='javascript:saveBOM();' onmouseover="window.status='Click to Save BOM Data';return true" onmouseout="window.status='';return true">
                            <img border="0" src="<%=chipTracContext%>/jsp/includes/images/save.gif" width="53" height="17" title="Click here to Save BOM Data">
                            </chiptrack:restrictedLink>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <a href="<%=chipTracContext%>/bomDataEntry.do"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/cancel.gif" width="53" height="17" onmouseover="window.status='Click to Cancel Changes';return true" onmouseout="window.status='';return true" title="Click here to Cancel Changes"></a>
                        </td>
                    </tr>
               </logic:equal>
               <logic:equal name ="action" value="save" >
                <tr>
                    <logic:equal name="bomDataEntryForm" property="lotId" value="-1">
                        <td width="25%"><font class="NArialL">New Lot Number: &nbsp;<font color="red">*</font></font></td>
                        <td width="25%" class="NArialL">
                            <html:text  property="lotNumber" size="25" styleClass="txfield" maxlength="50" name="bomDataEntryForm" />
                        </td>
                        <td width="50%" colspan=2><font class="NArialL">&nbsp;</font></td>
                    </logic:equal>
                    <logic:notEqual name="bomDataEntryForm" property="lotId" value="-1">
                        <td width="100%" colspan=4 class="NArialL">&nbsp;
                            <html:hidden  property="lotNumber" name="bomDataEntryForm" />
                        </td>
                    </logic:notEqual>
                </tr>
                <tr>
                    <td width="25%"><font class="NArialL">Quantity In: &nbsp;<font color="red">*</font></font></td>
                    <td width="25%">
                        <html:text name="bomDataEntryForm" property="qtyIn" size="17" styleClass="valuetxfield" onchange="cal()" maxlength="7" onkeypress="allowInteger()"/>
                    </td>
                    <td width="25%"><font class="NArialL">Quantity Out:</font></td>
                    <td width="25%">
                        <html:text name="bomDataEntryForm" property="qtyOut" size="17" styleClass="valuetxfield"/>
                        <%--<logic:equal property='bomLotBinDataEntered' name='bomDataEntryForm' value="false">
                            <html:text name="bomDataEntryForm" property="qtyOut" size="17" styleClass="valuetxfield" onchange="cal()" maxlength="7" onkeypress="allowInteger()"/>
                        </logic:equal>
                        <logic:equal property='bomLotBinDataEntered' name='bomDataEntryForm' value="true">
                            <html:text name="bomDataEntryForm" property="qtyOut" size="17" styleClass="valuetxfield" disabled="true"/>
                        </logic:equal>--%>
                    </td>
                </tr>
               <%-- <tr>
                    <td width="25%"><font class="NArialL">&nbsp;</font></td>
                    <td width="25%">&nbsp;</td>
                    <td></td>
                    <td width="25%"  class="NArialL" >
                        <a href="javascript:openBomBinLotDataEntry();" onMouseOver="window.status='Click here to Entry BOM Bin Data';return true" onMouseOut="window.status='';return true">
                        BOM Bin Data Entry</a>
                    </td>
                </tr>--%>
                <TR>
                    <TD width="25%"><font class="NArialL">Lot Category:<font color="red"><b>*</b></font></font></TD>
                    <TD width="25%" class="NArialL">
                        <html:select name="bomDataEntryForm" property="lotCategory" styleClass="txfield" >
                            <html:option value="">Select Lot Category</html:option>
                            <html:options collection="lotCategoryList" property="value" labelProperty="label"/>
                        </html:select>
                    </TD>
                    <TD width="25%"><font class="NArialL">Lot Status:<font color="red"><b>*</b></font></font></TD>
                    <TD width="25%" class="NArialL">
                        <html:select name="bomDataEntryForm" property="lotStatus" styleClass="txfield" >
                            <html:option value="">Select Lot Status</html:option>
                            <html:options collection="lotStatusList" property="value" labelProperty="label"/>
                        </html:select>
                    </TD>
                </TR>
                <tr>
                    <td width="25%"><font class="NArialL">Date In: &nbsp;<font color="red">*</font></font></td>
                    <td width="25%" class="NArialL">
                        <html:text name="bomDataEntryForm" property="dateIn" size="17" styleClass="txfield" maxlength="10"/>
                        <a href="javascript:openCalendar(document.bomDataEntryForm.dateIn)">
                        <img onMouseOver="window.status='Click here to select date';return true" onMouseOut="window.status='';return true" border="0" align='center'
                        src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20></a>
                    </td>
                    <td width="25%"><font class="NArialL">Date Out:&nbsp;&nbsp;</font></td>
                    <td width="25%" class="NArialL">
                        <html:text name="bomDataEntryForm" property="dateOut" size="17" styleClass="txfield"  maxlength="10"/>
                        <a href="javascript:openCalendar(document.bomDataEntryForm.dateOut)">
                        <img onMouseOver="window.status='Click here to select date';return true" onMouseOut="window.status='';return true" border="0" align='center'
                        src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20></a>
                    </td>
                </tr>
                <tr>
                    <td width="25%"><font class="NArialL">Date Code:</font></td>
                    <td width="25%">
                    <html:text name="bomDataEntryForm" property="dateCode" size="17" styleClass="txfield"  maxlength="50" /></td>
                    <logic:equal property='processType' name='bomDataEntryForm' value="Die Bank">
                        <td width="25%" class="NArialL">
                            <a href="javascript:toggleBinData();" onMouseOver="window.status='Click here to Entry BOM Bin Data';return true" onMouseOut="window.status='';return true">
                            BOM Bin Data Entry</a>
                        </td>
                    </logic:equal>
                    <%--<td width="25%"><font class="NArialL">Vendor Lot Number:</font></td>
                    <td width="25%">
                    <html:text name="bomDataEntryForm" property="vendorLot" size="17" styleClass="txfield"  maxlength="50" /></td>--%>
                </tr>
                <tr>
                    <td width="100%" colspan=4></td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td colspan="3">
                         <table align="center" border="0" id="binTable" style="display:none;" width="40%">
                            <tr>
                                <td width="10%" align='center' bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Wafer Id</font></td>
                                <td width="10%" align='center' bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Bin Qty</font></td>
                            </tr>
                            <nested:iterate property="bomLotBinData">
                                <tr>
                                    <nested:empty property="waferId">
                                        <td align='center'><nested:text property="waferId" readonly="false" size="6" styleClass="valuetxfield" onkeypress="javascript:allowInteger()"></nested:text></td>
                                    </nested:empty>
                                    <nested:notEmpty property="waferId" >
                                        <td align='center'><nested:text property="waferId" readonly="true" size="6" styleClass="valuetxfield"></nested:text></td>
                                    </nested:notEmpty>
                                    <td align='center'><nested:text property="binQty" size="8" styleClass="valuetxfield" onkeypress="javascript:allowInteger()" onchange= "javascript:calculateBinTotal();"></nested:text></td>
                                </tr>
                            </nested:iterate>
                            <nested:size id="binCount" property="bomLotBinData"></nested:size>
                            <script type="text/javascript">
                                binListSize = <%= binCount.intValue()%>;
                            </script>
                            <tr>
                                <td>&nbsp;</td>
                                <TD align=right><a href="javascript:addMore();"><img src="<%=chipTracContext%>/jsp/includes/images/addmore.gif" border="0" onmouseover="window.status='Click to Add Bin Info';return true" onmouseout="window.status='';return true" title="Click here to Add Bin Info"/></a></TD>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td class='NArialL'>Comments : </td>
                    <td colspan = 3>
                        <html:textarea property="comments" name="bomDataEntryForm"  styleClass="txfield" rows="4" cols="80" onkeypress="javascript:checkLength(this, 1000)" />
                    </td>
                </tr>
                <tr>
                    <td colspan="4"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td>
                </tr>
                <tr>
                    <td colspan="4" align=center>
                        <chiptrack:restrictedLink functionality='<%=Functionality.BOM_INVENTORY%>' action='<%=User.USER_ACTION_MODIFY%>' href='javascript:saveBOM();' onmouseover="window.status='Click to Save BOM Data';return true" onmouseout="window.status='';return true">
                            <img border="0" src="<%=chipTracContext%>/jsp/includes/images/save.gif" title="Click here to Save BOM Data"/>
                        </chiptrack:restrictedLink>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <a href="<%=chipTracContext%>/bomDataEntry.do"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/cancel.gif" width="53" height="17" onmouseover="window.status='Click to Cancel Changes';return true" onmouseout="window.status='';return true" title="Click here to Cancel Changes"></a>
                    </td>
               </tr>
            </logic:equal>
            <html:hidden property="partNumber" name="bomDataEntryForm"/>
            <html:hidden property="locationName" name="bomDataEntryForm"/>
            <logic:equal property='processType' name='bomDataEntryForm' value="Sort">
                <input type="hidden" name="binLotDataEneterd" value="<bean:write property='bomLotBinDataEntered' name='bomDataEntryForm'/>">
            </logic:equal>
            <logic:equal property='processType' name='bomDataEntryForm' value="Finished Goods">
                <input type="hidden" name="binLotDataEneterd" value="true">
            </logic:equal>
            </table>
   </table>
    </td>
   </tr>
</table>
</html:form>
<!-- till here -->
<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</BODY>
</HTML>
